/**
 * 
 */
package org.mspring.crm.server;

import org.mspring.crm.util.ConvertUtils;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

/**
 * @author Gao Youbo
 * @since 2012-3-6
 * 
 */
public class BaseRemote extends RemoteServiceServlet {
    @SuppressWarnings("unchecked")
    protected <X> X convertToEntity(Object object) {
        Object result = null;
        try {
            result = ConvertUtils.convertToClient(object);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return (X) result;
    }

    @SuppressWarnings("unchecked")
    protected <X> X convertToModel(Object object) {
        Object result = null;
        try {
            result = ConvertUtils.convertToModel(object);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return (X) result;
    }
}
